<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      >
    <ui:composition template="Template.xhtml">
        <ui:define name="top">
            #{bundle.create}#{bundle.depot}

        </ui:define>
        <ui:define name="content">
            <!--<shiro:hasPermission name="user:C">--> 

            <f:event listener="#{depotCreateMB.precreateDepot()}"
                     type="preRenderView"></f:event>
            <h:form id="form"  >
                <h:outputScript library="js" name="map/inputAutocomplete.js"/>
                <p:panel>

                    <div class="left"><h3>#{bundle.basic}#{bundle.info}</h3></div> 
                    <p:panelGrid styleClass="noborder left" columns="2"   >


                        <h:outputText value="#{bundle.depot}" />
                        <p:inputText value="#{depotCreateMB.currentdepot.name}"   required="true" requiredMessage="#{bundle.pleaseInput}#{bundle.depot}"/>


                        <h:outputText value="#{bundle.address}" />
                        <p:inputText class="address"  value="#{depotCreateMB.currentdepot.address}"  required="true" requiredMessage="#{bundle.pleaseInput}#{bundle.address}"/>





                    </p:panelGrid>
                    <p:inputText id="latitude" styleClass="nodisplay" value="#{depotCreateMB.currentdepot.latitude}"   required="true" requiredMessage="#{bundle.pleaseInput}#{bundle.userid}"/>
                    <p:inputText id="longitude" styleClass="nodisplay" value="#{depotCreateMB.currentdepot.longitude}"   required="true" requiredMessage="#{bundle.pleaseInput}#{bundle.userid}"/>
                    <div id="bmap" style="height:300px;width:100%"></div>
                    <p:separator />
                    <!--已选车辆列表-->
                    <div class="left"><h3>#{bundle.add}#{bundle.vehicle}</h3></div> 
                    <p:panel>

                        <p:dataTable var="item" value="#{depotCreateMB.vehicleList}" paginator="true" rows="10"
                                     paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
                                     rowsPerPageTemplate="5,10,15"   id="Table" lazy="true">

                            <p:column headerText="#{bundle.vehicle}#{bundle.id}" sortBy="#{item.idvehicle}" filterBy="#{item.idvehicle}">
                                <h:outputText value="#{item.idvehicle}" />
                            </p:column>
                            <p:column headerText="#{bundle.plate}" sortBy="#{item.plate}" filterBy="#{item.plate}">
                                <h:outputText value="#{item.plate}" />
                            </p:column>
<!--                            <p:column headerText="原归属#{bundle.depot}" sortBy="#{item.iddepot.name}" filterBy="#{item.iddepot.name}">
                                <h:outputText value="#{item.iddepot.name}" />
                            </p:column>-->
                            <p:column headerText="#{bundle.capacity}" sortBy="#{item.capacity}" filterBy="#{item.capacity}">
                                <h:outputText value="#{item.capacity}" />
                            </p:column>
                            <p:column headerText="#{bundle.perdispatchCost}" sortBy="#{item.dispatchCost}" filterBy="#{item.dispatchCost}">
                                <h:outputText value="#{item.dispatchCost}" />
                            </p:column>
                            <p:column headerText="#{bundle.unitTranCost}" sortBy="#{item.unitTranCost}" filterBy="#{item.unitTranCost}">
                                <h:outputText value="#{item.unitTranCost}" />
                            </p:column>
                            <p:column headerText="#{bundle.speed}" sortBy="#{item.speed}" filterBy="#{item.speed}">
                                <h:outputText value="#{item.speed}" />
                            </p:column>
                            <p:column style="width: 15%;text-align: center;">
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.operation}"/>
                                    <!--<shiro:hasPermission name="user:C">--> 
    <!--                                <p:button value=""   onclick="window.parent.addTab('#{bundle.create}#{bundle.userid}', 'user/user_create.xhtml');" style="margin-left: 15px" icon="ui-icon-plus">
                                    </p:button>-->
                                    <p:commandButton update=":growl" immediate="true" oncomplete="PF('selectvehicle').show();" value="#{bundle.add}#{bundle.vehicle}"/>

                                    <!--</shiro:hasPermission>-->
                                </f:facet>

                                <!--<shiro:hasPermission name="user:D">--> 
                                <p:commandButton value="#{bundle.delete}" action=" " update=":form:Table,:growl" >
                                    <p:confirm header="#{bundle.delete}" message="#{bundle.deleteAlert}" icon="ui-icon-alert" />
                                </p:commandButton>
                                <!--</shiro:hasPermission>-->
                            </p:column>
                        </p:dataTable>
                        <p:blockUI block="Table" trigger="Table">
                            LOADING<br />
                            <p:graphicImage name="img/ajaxloadingbar.gif"/>
                        </p:blockUI>
                    </p:panel>
                    <p:separator />
                    <p:panelGrid styleClass="noborder left"  style="width:100% " columns="1"   >

                        <p:commandButton value="#{bundle.conform}" validateClient="true" action="#{depotCreateMB.create()}"     update="@(.ui-panel:input),Table,:growl">
                            <p:confirm header="#{bundle.conform}" message="#{bundle.conform}" icon="ui-icon-alert" />
                        </p:commandButton>

                    </p:panelGrid>
                    <p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
                        <p:commandButton value="#{bundle.yes}" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
                        <p:commandButton value="#{bundle.no}" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
                    </p:confirmDialog>
                </p:panel>
            </h:form>



            <!--添加车辆-->
            <p:dialog header="#{bundle.select}#{bundle.vehicle}" widgetVar="selectvehicle" resizable="false" modal="true" width="100%">
                <ui:include src="selectvehicle.xhtml" />
            </p:dialog>

            <div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;" address=""></div>
            <!--</shiro:hasPermission>-->
        </ui:define>
    </ui:composition>
</html>

